/*
* @Author: yongqiang.sun
* @Date:   2018-01-29 22:08:23
* @Last Modified by:   yongqiang.sun
* @Last Modified time: 2018-01-29 22:18:40
*/

(function (window) {
    var $ = window.Zepto || window.jQuery;
    $(window.document).ready(function () {
        $('.overview-tabs .tab').click(function () {
            var isActive = $(this).hasClass('tab-active');
            var activeIndex = $(this).data('item');
            if (!isActive) {
                $(this).addClass('tab-active').siblings().removeClass('tab-active');
            }
            $('.overview-lists .proxy-overview').each(function (index, list) {
                if (index === activeIndex) {
                    $(list).show();
                } else {
                    $(list).hide();
                }
            })
        }).each(function (index, item) {
            $(item).data('item', index);
            if ($(item).hasClass('tab-active')) {
                $('.overview-lists .proxy-overview:nth-child(' + (index + 1) + ')').show();
            }
        });
    })
})(window);
